<?php
class PicAction extends HomeAction{
	public function show(){
		$this->header();    //导入页头
		$pic=M('Pic');
		$picattach=M('PicAttach');
		$picurl=M('Picurl');

		$list1=$pic->where(array('id'=>$_GET['id']))->find();
		$list2=$picattach->where(array('picid'=>$_GET['id']))->find();
		$list=array_merge($list1,$list2);

			import('ORG.Util.Page');					//导入分页类
			$count=$picurl->where()->count();			//获得符合条件的数据总数
			$Page=new Page($count,1);				//实例化分页类 传入数据总数		
			//定义分页样式
			$Page->setConfig('prev','上页');
			$Page->setConfig('next','下页');
			$Page->setConfig('first','首页');
			$Page->setConfig('last','末页');
			$Page->rollPage = $count;
			$Page->setConfig('theme','%first% %upPage% %linkPage% %downPage% %end%');
			 
			$show=$Page->show();						//分页显示输出

		$list['picurl']=$picurl->where(array('picid'=>$_GET['id']))->limit($Page->firstRow.','.$Page->listRows)->select();

		//中图地址
		for($i=0,$j=count($list['picurl']);$i<$j;$i++){
			$pics=explode('/',$list['picurl'][$i]['pics']);
			$pics[1]='m_'.$pics[1];
			$pics=implode('/',$pics);
			$list['picurl'][$i]['m_pics']=$pics;
		}

		$this->assign('picshow',true);
		$this->assign('page',$show);
		$this->assign('keywords',$list['keywords']);
		$this->assign('description',$list['description']);
		$this->assign('seotitle',$list['seotitle']);
		$this->assign('list',$list);
		$this->display();
	}
}